package com.qihetimes.earthangel.model.vo;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Collections;

/**
 * 分页返回对象
 *
 * @author ：f4cklangzi@gmail.com
 * @date ：Created At 2021/12/12
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class PageVO<T> extends Page<T> {
    
    public <F> PageVO(Page<F> page) {
        this.records = Collections.emptyList();
        this.total = page.getTotal();
        this.size = page.getSize();
        this.current = page.getCurrent();
        this.orders = page.getOrders();
        this.optimizeCountSql = page.isOptimizeCountSql();
        this.isSearchCount = page.isSearchCount();
        this.hitCount = page.isHitCount();
    }
}
